
package dieci.system;

import dieci.database.PersistentObject;
import dieci.utils.Redondeo;

/**
 *
 * @author DuckSys
 */
public class RawMaterial implements PersistentObject{

    private int rawMaterialId;
    private String name;
    private String messureUnit;
    private double amount;
    private double price;
    private int deleted;

    public RawMaterial()
    {
    }

    public RawMaterial(String name, String messureUnit, double amount, double price, int deleted)
    {
        this.name = name;
        this.messureUnit = messureUnit;
        this.amount = Redondeo.Redondear(amount,2);
        this.price = Redondeo.Redondear(price, 2);
        this.deleted = deleted;
    }

    public RawMaterial(int id, String name, String messureUnit, double amount, double price, int deleted)
    {
        this(name, messureUnit, amount, price,deleted);
        this.rawMaterialId = id;
    }
    
    /**
     * Get the value of rawMaterialId
     *
     * @return the value of rawMaterialId
     */
    public int getRawMaterialId()
    {
        return rawMaterialId;
    }

    /**
     * Set the value of rawMaterialId
     *
     * @param rawMaterialId new value of rawMaterialId
     */
    public void setRawMaterialId(int rawMaterialId)
    {
        this.rawMaterialId = rawMaterialId;
    }


    /**
     * Get the value of price
     *
     * @return the value of price
     */
    public double getPrice()
    {
        return price;
    }

    /**
     * Set the value of price
     *
     * @param price new value of price
     */
    public void setPrice(double price)
    {
        this.price = Redondeo.Redondear(price, 2);
    }

    /**
     * Get the value of amount
     *
     * @return the value of amount
     */
    public double getAmount()
    {
        return amount;
    }

    /**
     * Set the value of amount
     *
     * @param amount new value of amount
     */
    public void setAmount(double amount)
    {
        this.amount = Redondeo.Redondear(amount, 2);
    }

    
    /**
     * Get the value of messureUnit
     *
     * @return the value of messureUnit
     */
    public String getMessureUnit()
    {
        return messureUnit;
    }

    /**
     * Set the value of messureUnit
     *
     * @param messureUnit new value of messureUnit
     */
    public void setMessureUnit(String messureUnit)
    {
        this.messureUnit = messureUnit;
    }

    /**
     * Get the value of name
     *
     * @return the value of name
     */
    public String getName()
    {
        return name;
    }

    /**
     * Set the value of name
     *
     * @param name new value of name
     */
    public void setName(String name)
    {
        this.name = name;
    }

    public int getDeleted() {
        return deleted;
    }

    public void setDeleted(int deleted) {
        this.deleted = deleted;
    }    
    
    @Override
    public String toString(){
        return this.name +" - Unid Medida: "+ this.messureUnit+ " - $"+this.price;
    }
}
